﻿using System;
using System.Collections.Generic;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

namespace MLY.LTR
{
    public partial class contractorSearch2 : Bll.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            lblMsg.Visible = false;
            if (!Page.IsPostBack)
            {
                this.txthidContractorName.Value = "%^&*()";

                if (Request.QueryString["Name"] != null)
                {
                    txthidContractorName.Value = Request.QueryString["Name"];
                    contractorName.Text = Request.QueryString["Name"];
                }
            }
        }

        public void GetCompletionList(string prefixText)
        {


        }

        protected void submitMe_Click(object sender, EventArgs e)
        {

            ///   ListView1.Visible = true;
            // ListView1.Items.Clear();
            //     ListView1.DataSource = Bll.clsOrganization.GetContractorsForSearch(contractorName.Text, int.Parse(ddlClassification.SelectedValue), txtTag.Text);
            //  ListView1.DataBind(); 

            //ListView1.DataSource = Bll.clsOrganization.GetContractorsForSearch(contractorName.Text, int.Parse(ddlClassification.SelectedValue), txtTag.Text); 
            //ListView1.DataBind();
            this.txthidContractorName.Value = this.contractorName.Text;
        }

        protected void ListView1_PagePropertiesChanged(object sender, EventArgs e)
        {
            //  ListView1.DataBind();
        }

        protected void ddlClassification_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ddlClassification.Items.Clear();
                ListItem all = new ListItem("All", "0");
                ddlClassification.Items.Add(all);
                ddlClassification.AppendDataBoundItems = true;
            }
        }

        protected void LinqDataSource2_Selecting(object sender, LinqDataSourceSelectEventArgs e)
        {
            if (this.IsPostBack)
            {
                e.Result = Bll.clsOrganization.GetContractorsForSearch(contractorName.Text, int.Parse(ddlClassification.SelectedValue), txtTag.Text);
            }
            else
                e.Result = new Dictionary<Dal.TableOrganization, int>();
        }


    }
}
